import React, { Component } from 'react';
import { Provider } from 'react-redux';
import Header from './common/header';
import { BrowserRouter, Route } from 'react-router-dom'
import store from './store';
import Home from './pages/home';
import Login from './pages/login'
import Write from './pages/write'
import Detail from './pages/detail/loadable'
class App extends Component {
  render() {
    return ( 
     <Provider store={store}>
       <div>
         <BrowserRouter>
           <div>
             <Header/>
             <div>
             {/* exact 要求路由匹配完全相同*/}
               <Route path='/' exact component={Home}></Route>
               <Route path='/login' exact  component={Login}></Route>
               <Route path='/write' exact  component={Write}></Route>
               <Route path='/detail/:id' exact component={Detail}></Route>
             </div>
           </div>
         </BrowserRouter>
       </div>
      </Provider>
    );
  }
}

export default App;
